package com.pkx.cloud.fse7.dms.monitoring.service.impl;

import com.pkx.cloud.fse7.dms.monitoring.service.StatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Map;


/**
 * @author chenwg
 */
@Service
public class StatusServiceImpl implements StatusService {
    @Autowired
    private RedisTemplate redisTemplate;

    private final String REDIS_KEY = "door";

    /**
     * 设置门禁的状态
     *
     * @param id
     * @param value
     */
    @Override
    public void addStatus(String id, Integer value) {
        redisTemplate.opsForHash().put("fse7", id, value);
    }

    /**
     * 获取门禁状态
     *
     * @return
     */
    @Override
    public Map getStatus() {
        return redisTemplate.opsForHash().entries("fse7");
    }
}
